﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PSI.Services;
using PSI.Models;
using PSI.Helper;

namespace PSI.Controllers {
    public class BaseCodeAdminCategoryController : PSIBaseController {
        //
        // GET: /BaseCodeAdminCategory/

        public ActionResult Index() {
            return View();
        }

        [HttpPost]
        public ActionResult GetBaseCodeCateGoryItem() {
            var result = new BaseCodeCategoryService().GetCategoryItem();

            return Json(result);
        }

        [HttpPost]
        public ActionResult AddorEditBaseCodeCateGory(BaseCodeCategory model) {

            var result = new BaseCodeCategoryService().AddOrEditCategory(model);

            return Json(result);
        }

        public ActionResult DelBaseCodeCateGory(BaseCodeCategory model) {
            var result = new BaseCodeCategoryService().DelCategory(model);

            return View(result) ;
        }

        [HttpPost]
        public ActionResult GetCateGoryTreeItem() {

            var json = new BaseCodeCategoryService().GetTreeItem();

            return Json(json);
        }


    }
}
